platform: use FILE_FLAG_WRITE_THROUGH on Windows for SyncFile data durability, fixes #9388#9389
platform: use FILE_FLAG_WRITE_THROUGH on Windows for SyncFile data durability, fixes #9388#9389mr-raj12 wants to merge 1 commit intoborgbackup:masterfrom
Conversation
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
ThomasWaldmann
left a comment
There was a problem hiding this comment.
some minor things i found
|
Also: Please update your local master branch and then rebase this branch onto that master and force push. That should solve the CI test failures that are unrelated to your work. |
59dcf0e to
5df3cfb
Compare
ThomasWaldmann
left a comment
There was a problem hiding this comment.
one idea about reducing these in-function imports.
i am not familiar with the windows api, did you check yourself that this win32 api usage is how it should be?
5df3cfb to
fcbd613
Compare
Yes cross checked everything against the CreateFileW and _open_osfhandle docs |
SyncFile |
Description
Implement Windows-native
SyncFileusingCreateFileWwithFILE_FLAG_WRITE_THROUGHto bypass volatile write caches and write directly to persistent storage. This is the Windows equivalent of the macOSF_FULLFSYNCfix (#9383 / PR #9385).Fixes #9388
Changes
src/borg/platform/windows.pyx— addSyncFilesubclass usingCreateFileW+FILE_FLAG_WRITE_THROUGH; falls back to base when an existing fd is provided (e.g.SaveFile)src/borg/platform/__init__.py— importSyncFilefrom.windowsinstead of.basesrc/borg/platform/base.py— update resolved TODO commentsrc/borg/testsuite/platform/platform_test.py— addskipif_not_win32markersrc/borg/testsuite/platform/windows_test.py— 6 tests (write/read, FileExistsError, text mode, fd fallback, sync, write-through flag verification)Checklist
master(or maintenance branch if only applicable there)toxor the relevant test subset)